package com.xiaohudie.controller;

import com.xiaohudie.pojo.AjaxResult;
import com.xiaohudie.pojo.ShangHu;
import com.xiaohudie.servier.Impi.ShangHuServierImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author xiao hu die
 * @Date 2022/3/3 18:45
 * @Version 1.0
 */
@RestController
@RequestMapping("/shanghu")
public class ShangHuController {
    @Resource
    private ShangHuServierImpl shangHuServier;
    @GetMapping("/select")
    public AjaxResult getShangHu(@RequestParam("id") Integer id){
        ShangHu shangHu = shangHuServier.queryById(id);
        return AjaxResult.success(shangHu);
    }
    @GetMapping("/cache")
    public AjaxResult getCache(Integer id){
        AjaxResult ajaxResult = shangHuServier.cacheById(id);
        return ajaxResult;
    }
    @PutMapping("/update")
    public AjaxResult update(@RequestBody() ShangHu shangHu){
        shangHuServier.updateShangHu(shangHu);
     return AjaxResult.success("更新数据成功");
    }

}
